package com.xiaoma.weblog.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiaoma.weblog.common.domain.dos.CategoryDO;

/**
 * @ClassName CategoryMapper
 * @Description:
 * @Author: 小马
 * @CreateDate: 2025/3/28 10:48
 * @Version: 1.0
 */
public interface CategoryMapper extends BaseMapper<CategoryDO> {
    /**
     * 根据用户名查询
     * @param name
     * @return
     */
    default CategoryDO selectByName(String name) {
        LambdaQueryWrapper<CategoryDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(CategoryDO::getName, name);
        return selectOne(lambdaQueryWrapper);
    }
}